#include "mem/sram.h"
#include <string.h>

Sram::Sram(u64 sram_size){
    SramSize = sram_size;
    SramArray = new s8[sram_size];
}

Sram::~Sram(){
    delete [] SramArray;
}

void Sram::write_mem(u64 dst, void* src, u64 length){
   CHECK((dst + length) <= SramSize);
   memcpy(SramArray + dst, src, length);
   return;
}

void Sram::read_mem(void* dst, u64 src, u64 length){
   CHECK((src + length) <= SramSize);
   memcpy(dst, SramArray + src, length);
   return;
}

u64 Sram::get_ram_size(){
    return SramSize;
}

void* Sram::get_ram_pointer(){
    return SramArray;
}

